package com.eascs.banknet.boc.dao;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

import com.eascs.banknet.common.dao.BaseO2oDao;
import com.eascs.banknet.common.entity.DataListEntity;

@Repository
public class DataListDao extends BaseO2oDao{
	/**
	 * 查询附件信息、
	 * @param loanapplyNo	贷款单号
	 * @param datalistCode  类型
	 * @return
	 */
	public List<DataListEntity> getFileDataList(String loanapplyNo, List<String> datalistCode){
		String str="('" + StringUtils.join(datalistCode,"','") + "')";
		String sql = "select * from o2o_datalist where is_delete = 'N' and loanapply_no = ? and datalist_code in"+str;
		return super.findEntitys(sql, DataListEntity.class, loanapplyNo);
	}
	
	public int getFileCount(String loanapplyNo, String datalistCode){
		String sql = "select count(*) from o2o_datalist where is_delete = 'N' and loanapply_no = ? and datalist_code = ?";
		return super.findInteger(sql, loanapplyNo, datalistCode);
	}
}
